<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    商品价格
    {{item.price | currency}}
    {{ item.price | currency2('$') }}
    {{item.price | currency2}}
    {{ 'hello' | capticalSize }}
  </div>
  <script src="./vue.js"></script>
  <script>
    // 全局过滤器
    Vue.filter('currency', (v)=>{
      console.log(v)
      return '￥'+v;
    })
    Vue.filter('currency2', (v, sign='￥')=>{
      return sign+v;
    })
    const vm = new Vue({
      el: '#app',
      data: {
        item:{
          price: 10
        }
      },
      filters: {
        capticalSize:(v)=>{
          return v[0].toUpperCase()+v.substr(1)
        }
      }
    })
  </script>
</body>
</html>